﻿/**********************************************************************
 * @file   GUICurvePlotSettingsDialog.h
 * @brief  曲线设置属性窗口声明
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2025-02-19
 *********************************************************************/
#ifndef GUICurvePlotSettingsDialog_H
#define GUICurvePlotSettingsDialog_H

#include "GUIWidget/GUIDialogBase.h"

namespace Ui {
class GUICurvePlotSettingsDialog;
}

namespace Plot {
    class FITKXYPlotWindow;
}

class QTableWidget;

namespace GUI
{
    /**
     * @brief  曲线设置属性窗口
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2025-02-19
     */
    class GUICurvePlotSettingsDialog : public Core::FITKDialog
    {
        Q_OBJECT

    public:
        explicit GUICurvePlotSettingsDialog(QWidget *parent = nullptr);
        ~GUICurvePlotSettingsDialog();
        /**
         * @brief    初始化
         * @param[i] freqValue 
         * @param[i] curvePlotWidget 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void init(std::vector<float>* freqValue, Plot::FITKXYPlotWindow* curvePlotWidget);
        /**
         * @brief    获取频谱范围
         * @param[i] range 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void getFreqRange(double* range);
        /**
         * @brief    获取Y轴算法参数
         * @param[i] aWeight 
         * @param[i] dB 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void getYAxisCalcValue(bool& aWeight, double& dB);
        /**
         * @brief    更新曲线图表属性
         * @param[i] curvePlotWidget 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void updateCurvePlot(Plot::FITKXYPlotWindow* curvePlotWidget);

    protected slots:
        /**
         * @brief cencel button clicked slot
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-10-23
         */
        void on_pushButton_Cancel_clicked();
        /**
         * @brief OK button clicked slot
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date 2024-10-23
         */
        void on_pushButton_OK_clicked();
        /**
         * @brief    groupBox DB clicked slot
         * @param[i] checked 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void on_groupBox_DB_clicked(bool checked);
        /**
         * @brief    slot
         * @param[i] index 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void on_comboBox_StartFreq_currentIndexChanged(int index);
        /**
         * @brief    slot
         * @param[i] index 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void on_comboBox_EndFreq_currentIndexChanged(int index);
        /**
         * @brief    slot
         * @param[i] state 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void on_checkBox_xAxisAutoscale_stateChanged(int state);
        /**
         * @brief    slot
         * @param[i] state 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void on_checkBox_yAxisAutoscale_stateChanged(int state);
        /**
         * @brief    slot
         * @param[i] state 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void on_radioButton_Default_clicked(bool state);
        /**
         * @brief    slot
         * @param[i] state 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void on_radioButton_UserDefind_clicked(bool state);

    private:
        /**
         * @brief    初始化窗口
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-20
         */
        void initWidget();
        /**
         * @brief    初始化频率下拉框数据
         * @param[i] freqValue 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void initFreqComboBox(std::vector<float>* freqValue);
        /**
         * @brief    初始化曲线图表设置
         * @param[i] curvePlotWidget 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-21
         */
        void initCurvePlotSettings(Plot::FITKXYPlotWindow* curvePlotWidget);

    private:
        /**
         * @brief  ui object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-19
         */
        Ui::GUICurvePlotSettingsDialog *_ui;
    };
}

#endif // GUICurvePlotSettingsDialog_H
